//
//  ViewController.swift
//  DragGestureRecognizer
//
//  Created by fanxiaoxin_1987@126.com on 11/22/2021.
//  Copyright (c) 2021 fanxiaoxin_1987@126.com. All rights reserved.
//

import UIKit
import FXDragGestureRecognizer

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        
        let view = UIView(frame: .init(x: 20, y: 20, width: 300, height: 500))
        view.backgroundColor = .yellow
        let drag = FXDragGestureRecognizer(target: self, action: #selector(self.onDrag(_:)))
        view.addGestureRecognizer(drag)
        self.view.addSubview(view)
    }
    
    @objc func onDrag(_ gr: FXDragGestureRecognizer) {
        debugPrint("\(gr.dragState.rawValue): \(gr.direction) - \(gr.offset(in: self.view)); \(gr.currentDirection) - \(gr.currentOffset(in: self.view)); ")
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

